package com.sky.mapper;

import com.sky.entity.SetMealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 查询菜品套餐关联关系
     * @param dishIds
     * @return
     */
    List<Long> countByDishId(List<Long> dishIds);

    /**
     * 批量插入套餐菜品数据
     * @param setMealDishes
     * @return
     */
    void insertBatch(List<SetMealDish> setMealDishes);

    /**
     * 根据套餐id删除套餐菜品数据
     * @param setmealIds
     * @return
     */
    void deleteBySetmealIds(List<Long> setmealIds);

    /**
     * 根据套餐id查询套餐菜品数据
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetMealDish> getSetmealDishBySetmealId(Long setmealId);

    /**
     * 根据套餐id删除套餐菜品数据
     * @param setmealId
     * @return
     */
    @Select("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据套餐id查询包含的菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<DishItemVO> getDishesBySetmealId(Long id);
}
